<?php

namespace App\Http\Middleware;

use App\Modules\Manage\ManagerModel;
use Closure;
use Illuminate\Support\Facades\Session;
use Theme;
class ManageAuth
{


    
    public function handle($request, Closure $next)
    {
        if (!Session::get('manager')) {
            return redirect('/manage/login');
        } else {
            $manager = \App\Modules\Manage\Model\ManagerModel::getManager();
            Theme::setManager($manager->username);
            Theme::setManagerID($manager->id);
        }
        return $next($request);
    }
}
